define(["jquery","bbcare","bld/app/classify/programList.ui"], function($,$bb,$ui){
    var servers = {};
    var URL = $bb.baseUrl("blood");

    /**
     * 查询方案列表
     */
    servers.ajaxQueryAllScheme = function(params,callback) {
        $bb.ajax({
            url: URL + "scheme/queryAllScheme",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "查询方案列表出错！");
                }
            }
        });
    }

    /**
     * 添加方案
     */
    servers.ajaxAddScheme = function(params,callback){
        $bb.ajax({
            url: URL + "scheme/addScheme",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "添加方案出错！");
                }
            }
        });
    }

    /**
     * 删除方案
     */
    servers.ajaxDeleteScheme = function(params,callback){
        $bb.ajax({
            url: URL + "scheme/deleteScheme",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "删除方案出错！");
                }
            }
        });
    }

    /**
     * 复制方案
     */
    servers.ajaxCopyScheme = function(params,callback) {
        $bb.ajax({
            url: URL + "scheme/copyScheme",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "复制方案出错！");
                }
            }
        });
    }

    return servers;
});